import { BrowserWindow } from 'electron'
// import { OsBridge } from 'os-bridge'
// type OsBridge = typeof OsBridge
export class AppGlobalBridge {
  static readonly version = '1.0.0'
  static readonly appName = 'os-bridge'
  win: any
  type: number = 0
  // osBridge: OsBridge | null = null

  constructor(win: BrowserWindow | null) {
    this.win = win
    // this.osBridge = new OsBridge('win-os')
    this.listen()
  }

  listen() {
    //判断窗口最大化的函数
    // win.isMaximized()

    //监听窗口最大化
    this.win.on('maximize', () => {
      console.log('maximize')
      this.win.webContents.send('mainWin-max', true)
      // this.win.setFullScreen(true)
    })

    // 最小化事件
    this.win.on('unmaximize', () => {
      console.log('unmaximize')
      this.win.webContents.send('mainWin-max', false)
    })
  }
}

export default AppGlobalBridge
